//
//  SinaNaviBaseController.m
//  MySinaWeiboProjectForOC
//
//  Created by apple on 2016/11/12.
//  Copyright © 2016年 WangChen. All rights reserved.
//

#import "SinaNaviBaseController.h"
#import "UIBarButtonItem+extension.h"

@interface SinaNaviBaseController ()

@end

@implementation SinaNaviBaseController

- (void)viewDidLoad {
    [super viewDidLoad];
    
}



#pragma mark
#pragma mark - 重写push方法
-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    
    
    if(self.childViewControllers.count > 0){
        
        UIBarButtonItem *btnItem = [[UIBarButtonItem alloc]initWithTitle:@"返回" image:@"navigationbar_back_withtext" addTarget:self action:@selector(backDidClick)];
        
        viewController.navigationItem.leftBarButtonItem = btnItem;
        
        viewController.hidesBottomBarWhenPushed = YES;
    }
    
    [super pushViewController:viewController animated:animated];
}





#pragma mark
#pragma mark - 监听返回按钮
-(void)backDidClick{
    
    [self popViewControllerAnimated:YES];
    
}




@end
